import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { QuestionaireSelectVO, QuestionaireSelectForm, QuestionaireSelectQuery } from '@/api/stroke/questionaireSelect/types';

/**
 * 查询问卷选项列表
 * @param query
 * @returns {*}
 */

export const listQuestionaireSelect = (query?: QuestionaireSelectQuery): AxiosPromise<QuestionaireSelectVO[]> => {
  return request({
    url: '/stroke/questionaireSelect/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询问卷选项详细
 * @param id
 */
export const getQuestionaireSelect = (id: string | number): AxiosPromise<QuestionaireSelectVO> => {
  return request({
    url: '/stroke/questionaireSelect/' + id,
    method: 'get'
  });
};

/**
 * 新增问卷选项
 * @param data
 */
export const addQuestionaireSelect = (data: QuestionaireSelectForm) => {
  return request({
    url: '/stroke/questionaireSelect',
    method: 'post',
    data: data
  });
};

/**
 * 修改问卷选项
 * @param data
 */
export const updateQuestionaireSelect = (data: QuestionaireSelectForm) => {
  return request({
    url: '/stroke/questionaireSelect',
    method: 'put',
    data: data
  });
};

/**
 * 删除问卷选项
 * @param id
 */
export const delQuestionaireSelect = (id: string | number | Array<string | number>) => {
  return request({
    url: '/stroke/questionaireSelect/' + id,
    method: 'delete'
  });
};
